//
//  CAOrderDetailHeaderView.m
//  LNH
//
//  Created by twentylx on 2018/2/14.
//  Copyright © 2018年 twentylx. All rights reserved.
//

#import "CAOrderDetailHeaderView.h"

@implementation CAOrderDetailHeaderView

/**
 为视图绑定 viewModel
 
 @param viewModel 要绑定的ViewModel
 @param params 额外参数
 */
- (void)bindViewModel:(id <LMViewProtocol>)viewModel withParams:(NSDictionary *)params {
    
}

/**
 初始化额外数据
 */
- (void)lm_initializeForView {
    self.backgroundColor = RGBCOLOR(232, 85, 19);
}

/**
 初始化视图
 */
- (void)lm_createViewForView {
    [self setNeedsUpdateConstraints];
    
    [self addSubview:self.orderStatusLabel];
    [self addSubview:self.orderNoLabel];
    [self addSubview:self.orderDateLabel];
}

#pragma mark layout
- (void)updateConstraints {
    [super updateConstraints];
    
    [self.orderStatusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(20);
        make.top.equalTo(self).offset(30);
    }];
    
    [self.orderNoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(20);
        make.top.equalTo(self.orderStatusLabel.mas_bottom).offset(10);
    }];
    
    [self.orderDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(20);
        make.top.equalTo(self.orderNoLabel.mas_bottom).offset(10);
    }];
}

#pragma mark get & set
- (UILabel *)orderStatusLabel {
    if (!_orderStatusLabel) {
        _orderStatusLabel = [UILabel new];
        _orderStatusLabel.text = @"交易完成";
        _orderStatusLabel.textColor = [UIColor whiteColor];
        _orderStatusLabel.font = [UIFont systemFontOfSize:20];
    }
    return _orderStatusLabel;
}

- (UILabel *)orderNoLabel {
    if (!_orderNoLabel) {
        _orderNoLabel = [UILabel new];
        _orderNoLabel.text = @"订单编号：1231238594738423";
        _orderNoLabel.textColor = [UIColor whiteColor];
        _orderNoLabel.font = [UIFont systemFontOfSize:16];
    }
    return _orderNoLabel;
}

- (UILabel *)orderDateLabel {
    if (!_orderDateLabel) {
        _orderDateLabel = [UILabel new];
        _orderDateLabel.text = @"下单时间：2018-02-14 18:00:00";
        _orderDateLabel.textColor = [UIColor whiteColor];
        _orderDateLabel.font = [UIFont systemFontOfSize:16];
    }
    return _orderDateLabel;
}

@end
